package ibms_rcp.worker.handlers;

import javax.inject.Inject;

import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.eclipse.e4.ui.workbench.modeling.EPartService;

public class InfoHandler {

	@Inject private EModelService modelService;
	
	@Execute
	public void execute(MApplication app, EPartService partService){
		MPerspective element = (MPerspective) modelService.find("ibms_rcp.perspective.worker.info", app);
		// Now switch perspective
		partService.switchPerspective(element);

		System.out.println("InfoHandler execute called.");
	}
	
	//Technically not needed
	//will default to true
	@CanExecute
	public boolean canExecute(){
		return true;
	}
}
